﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.WindowsAzure.StorageClient;

namespace CPlase
{
    public static class DeleteUtils
    {
        public static bool DeleteList<T>(TableServiceContext Context, IEnumerable<T> ItemsToDelete) where T : TableServiceEntity
        {
            try
            {
                foreach (var ItemToDelete in ItemsToDelete)
                {
                    Context.DeleteObject(ItemToDelete);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }

        public static bool DeleteObject(TableServiceContext Context, TableServiceEntity ItemToDelete)
        {
            try
            {
                Context.DeleteObject(ItemToDelete);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}